package idz.jsf;

import java.io.Serializable;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;

@ManagedBean(name = "loginBean")
@SessionScoped
public class LoginBean implements Serializable
{
	private static final long serialVersionUID = 6310174413227396221L;
	@ManagedProperty(value = "#{dataBean}")
	private DataBean data;
	
	private String user;
	private String pass;
	private boolean ok;
	
	public void setData(DataBean data)
	{
		this.data = data;
	}
	
	public String getUser()
	{
		return user;
	}
	
	public void setUser(String user)
	{
		this.user = user;
	}
	
	public String getPass()
	{
		return pass;
	}
	
	public void setPass(String pass)
	{
		this.pass = pass;
	}

	public boolean isOk()
	{
		return ok;
	}

	public void setOk(boolean ok)
	{
		this.ok = ok;
	}
	
	public void login ()
	{
		this.ok = data.loginUser(user, pass);
	}
	
	public String goToOtherPage()
	{
		return "log_in_result";
	}
}
